package com.iworkh.spring.genericdi;

import com.iworkh.spring.genericdi.domain.Student;
import com.iworkh.spring.genericdi.service.StudentService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 入口类
 *
 * @author: iworkh-沐雨云楼
 * @date: 2019-12-18
 */
@Configuration
@ComponentScan(basePackages = "com.iworkh.spring.genericdi")
public class App {

    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(App.class);
        StudentService studentService = (StudentService) context.getBean("studentService");
        studentService.save(new Student("iworkh",2));
    }
}
